package cn.edu.ctgu.junitTest;


public class PreminumCaculator {
	public int age,raise;
	public String marriage;
	private char sex;
	
public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public int getRaise() {
		return raise;
	}
	public void setRaise(int raise) {
		this.raise = raise;
	}
	public String getMarriage() {
		return marriage;
	}
	public void setMarriage(String marriage) {
		this.marriage = marriage;
	}
	public char getSex() {
		return sex;
	}
	public void setSex(char sex) {
		this.sex = sex;
	}
/**返回性别
 * @return
 * @throws PremiumCaculatorException 
 * */
	
	public int getSexPoint() throws PremiumCaculatorException {
		
		 if (sex == 'M' || sex == 'm') {
			  return 4;
		}else if (sex == 'F' || sex == 'f') {
			return 3;
		}else{
			 throw new PremiumCaculatorException("性别参数不正确");
			 }
	}
	  /**
     * 
     * @return
	 * @throws PremiumCaculatorException 
     */
    public int getMarriagePoint() throws PremiumCaculatorException {
        if ("已婚".equals(marriage)) {
            return 3;
        } else if ("未婚".equals(marriage)) {
            return 5;
        } else {
            throw new PremiumCaculatorException("婚姻参数不正确");
        }
    }
    /**
     * 计算抚养人数点数
     * 
     * @return
     */
    public int getRaisePoint() {
        if (raise == 0) {
            return 0;
        } else if (raise >= 1 && raise <= 2) {
            return 1;
        } else if (raise <= 4) {
            return 2;
        } else {
            return 3;
        }
    }
	public int getAgePoint() throws PremiumCaculatorException {
	     if (age >= 1 && age < 20) {
	            return 2;
	        } else if (age <= 39) {
	            return 6;
	        } else if (age <= 59) {
	            return 4;
	        } else if (age <= 99) {
	            return 2;
	        } else {
	            throw new PremiumCaculatorException("年龄参数不正确");
	        }

	
}

	
}
